//
//  BaseDataRequest.m
//  JiuLe
//
//  Created by 黄鑫 on 16/9/6.
//  Copyright © 2016年 Fine. All rights reserved.
//

#import "BaseDataRequest.h"
#import "UserDataMarco.h"

@implementation BaseDataRequest
- (void)userLoginName:(NSString *)name password:(NSString *)password withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    // 1.创建请求管理对象
    AFHTTPSessionManager *mgr = [AFHTTPSessionManager manager];
    mgr.requestSerializer = [AFJSONRequestSerializer serializer];
    mgr.requestSerializer.timeoutInterval = 30.0;
    mgr.responseSerializer = [AFJSONResponseSerializer serializer];
    mgr.responseSerializer.acceptableContentTypes = [NSSet setWithArray:@[@"application/json",@"text/html"]];
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:name forKey:@"name"];
    [dict setObject:password forKey:@"password"];
    // 2.发送请求
    [mgr POST:[BASEURL stringByAppendingString:@"personinfo/dologin"] parameters:dict progress:^(NSProgress * _Nonnull uploadProgress) {
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        id dic =   [self changeType:responseObject];
        NSInteger status = [[dic objectForKey:@"status"] integerValue];
        if (status == 0) {
            if (block) {
                block(dic,@"0",nil);
            }
        }else{
            if (block) {
                block(dic,@"1",nil);
            }
        }
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        if (block) {
            block(nil,@"1",error);
        }
    }];
}

//激活接口
- (void)doactive:(NSMutableDictionary *)doactive withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    // 1.创建请求管理对象
    AFHTTPSessionManager *mgr = [AFHTTPSessionManager manager];
    mgr.requestSerializer = [AFJSONRequestSerializer serializer];
    mgr.requestSerializer.timeoutInterval = 30.0;
    mgr.responseSerializer = [AFJSONResponseSerializer serializer];
    mgr.responseSerializer.acceptableContentTypes = [NSSet setWithArray:@[@"application/json",@"text/html"]];
    // 2.发送请求
    [mgr POST:[BASEURL stringByAppendingString:@"personinfo/doactive"] parameters:doactive progress:^(NSProgress * _Nonnull uploadProgress) {
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        id dic =   [self changeType:responseObject];
        NSInteger status = [[dic objectForKey:@"status"] integerValue];
        if (status == 0) {
            if (block) {
                block(dic,@"0",nil);
            }
        }else{
            if (block) {
                block(dic,@"1",nil);
            }
        }
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        if (block) {
            block(nil,@"1",error);
        }
    }];
}

//手机号登陆
- (void)loginUserPhone:(NSString *)phone verificationCode:(NSString *)code withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:phone forKey:@"mobile"];
    [dict setObject:code forKey:@"code"];
    [self basePostRequset:[BASEURL stringByAppendingString:@"Personinfo/mobilelogin"] parameters:dict withBlock:block];
}

//获取登陆验证码
- (void)getverificationCodePhone:(NSString *)phone withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:phone forKey:@"mobile"];
    [self basePostRequset:[BASEURL stringByAppendingString:@"Personinfo/loginsmsrequest"] parameters:dict withBlock:block];
}

//修改用户名
- (void)modifyUserName:(NSString *)newName withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:newName forKey:@"new_name"];
    [dict setObject:[[NSUserDefaults standardUserDefaults] objectForKey:UserDataID] forKey:@"user_id"];
    [self basePostRequset:[BASEURL stringByAppendingString:@"personinfo/modlogname"] parameters:dict withBlock:block];
}

//修改密码
- (void)modifyUserPassward:(NSString *)newPassword oldPassword:(NSString *)oldPassword withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:oldPassword forKey:@"old_password"];
    [dict setObject:newPassword forKey:@"new_password"];
    [dict setObject:[[NSUserDefaults standardUserDefaults] objectForKey:UserDataID] forKey:@"user_id"];
    [self basePostRequset:[BASEURL stringByAppendingString:@"personinfo/modpwd"] parameters:dict withBlock:block];
}

//修改手机号
- (void)modifyUserPhone:(NSString *)phone withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:phone forKey:@"new_mobile"];
    [dict setObject:[[NSUserDefaults standardUserDefaults] objectForKey:UserDataID] forKey:@"user_id"];
    [self basePostRequset:[BASEURL stringByAppendingString:@"personinfo/modmobile"] parameters:dict withBlock:block];
}

//查询用户信息
- (void)getUserInfoWithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:[[NSUserDefaults standardUserDefaults] objectForKey:UserDataID] forKey:@"user_id"];
    [self basePostRequset:[BASEURL stringByAppendingString:@"personinfo/querypersoninfo"] parameters:dict withBlock:block];
}

//请求人群分类
- (void)populationWithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Personinfo/get_crowdtype"] parameters:nil withBlock:block];
}

//修改紧急联系人
- (void)modifyEmergencyNmae:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"personinfo/modcontact"] parameters:dict withBlock:block];
}

//修改收货地址
- (void)modifyShippingAddress:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"personinfo/modlocation"] parameters:dict withBlock:block];
}

//修改身体资料
- (void)modifyBodyProfole:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Personinfo/modbodyinfo"] parameters:dict withBlock:block];
}

//获取久乐表基本信息接口
- (void)queryWatchinfowithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:[[NSUserDefaults standardUserDefaults] objectForKey:UserDataID] forKey:@"user_id"];
    [self basePostRequset:[BASEURL stringByAppendingString:@"personinfo/querywatchinfo"] parameters:dict withBlock:block];
}

//意见反馈
- (void)feedback:(NSString *)text imageArr:(NSMutableArray *)arrImage withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    NSString *userID = [[NSUserDefaults standardUserDefaults] objectForKey:UserDataID];
    if ([userID isEqualToString:@"(null)"] || [userID isEqualToString:@""] || userID == nil || userID == NULL) {
        userID = @"0";
    }
    [dict setObject:userID forKey:@"user_id"];
    [dict setObject:text forKey:@"fb_info"];
    [dict setObject:arrImage forKey:@"pic"];
    [self basePostRequset:[BASEURL stringByAppendingString:@"personinfo/fbinfo"] parameters:dict withBlock:block];
}


//请求健康数据
- (void)getHealthData:(NSString *)date withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:[[NSUserDefaults standardUserDefaults] objectForKey:UserDataID] forKey:@"user_id"];
    [dict setObject:date forKey:@"date"];

    [self basePostRequset:[BASEURL stringByAppendingString:@"health/querysummaryhealth"] parameters:dict withBlock:block];
}

//请求详细健康数据
- (void)getDetailedHealthData:(NSMutableDictionary *)dict WithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"health/queryhealth"] parameters:dict withBlock:block];
}

//请求预警信息
- (void)getEarlyWarningData:(NSMutableDictionary *)dict WithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"ThirdWarning/queryhistorywarn"] parameters:dict withBlock:block];
}

//请求预警类型
- (void)requestEarlyWarningType:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"ThirdWarning/typeshow"] parameters:dict withBlock:block];
}

//请求预警详情信息
- (void)getEarlyWarningDetailsData:(NSMutableDictionary *)dict WithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"ThirdWarning/querywarndetail"] parameters:dict withBlock:block];
}

//请求修改用户手机验证码
- (void)getVerificationCode:(NSString *)verificationCode WithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:[[NSUserDefaults standardUserDefaults] objectForKey:UserDataID] forKey:@"user_id"];
    [dict setObject:verificationCode forKey:@"new_mobile"];
    [self basePostRequset:[BASEURL stringByAppendingString:@"Personinfo/smscheckout"] parameters:dict withBlock:block];
}

//修改用户绑定手机
- (void)changeBindYourPhone:(NSString *)phone code:(NSString *)code withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:[[NSUserDefaults standardUserDefaults] objectForKey:UserDataID] forKey:@"user_id"];
    [dict setObject:phone forKey:@"new_mobile"];
    [dict setObject:code forKey:@"code"];
    [self basePostRequset:[BASEURL stringByAppendingString:@"Personinfo/modmobile"] parameters:dict withBlock:block];
}

//请求闹钟数据
- (void)getAlarmClockWithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:[[NSUserDefaults standardUserDefaults] objectForKey:UserDataID] forKey:@"user_id"];
    [self basePostRequset:[BASEURL stringByAppendingString:@"personinfo/queryclock"] parameters:dict withBlock:block];
}

//设置闹钟
- (void)setAlarmClock:(NSMutableDictionary *)dict WithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Personinfo/saveclock"] parameters:dict withBlock:block];
}

//删除闹钟
- (void)delegateAlarmClock:(NSMutableDictionary *)dict WithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Personinfo/deleteclock"] parameters:dict withBlock:block];
}

//获取用户积分
- (void)getGrades:(NSMutableDictionary *)dict WithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"ShoppingMall/myselfscorelist"] parameters:dict withBlock:block];
}

//请求订单列表
- (void)getOrderLiset:(NSMutableDictionary *)dict WithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"ShoppingMall/myselforderlist"] parameters:dict withBlock:block];
}

//请求订单详情
- (void)getOrderDetail:(NSMutableDictionary *)dict WithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"ShoppingMall/orderdetails"] parameters:dict withBlock:block];
}

//取消订单
- (void)cancelOrder:(NSMutableDictionary *)dict WithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"ShoppingMall/cancelorder"] parameters:dict withBlock:block];
}

//确认收货
- (void)sureReceipt:(NSString *)orderID withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:orderID forKey:@"orderid"];
    [dict setObject:[[NSUserDefaults standardUserDefaults] objectForKey:UserToken] forKey:@"token"];
    [dict setObject:[[NSUserDefaults standardUserDefaults] objectForKey:UserDataID] forKey:@"user_id"];
    [self basePostRequset:[BASEURL stringByAppendingString:@"ShoppingMall/confirmorder"] parameters:dict withBlock:block];
}

//请求文章列表
- (void)getArticleList:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Article/articlelist"] parameters:dict withBlock:block];
}

//判断文章是否被收藏
- (void)getArticlecollectStart:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Article/articledetail"] parameters:dict withBlock:block];
}

//文章收藏
- (void)articleCollect:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Article/articlecollect"] parameters:dict withBlock:block];
}

//文章收藏列表
- (void)articleCollectList:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Article/collectlist"] parameters:dict withBlock:block];
}

//获取健康排行
- (void)getRankingList:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Health/healthrank"] parameters:dict withBlock:block];
}

//获取健康报告统计数据
- (void)getStatistice:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Health/statistice"] parameters:dict withBlock:block];
}

//获取秘钥
- (void)getEncryptedData:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Login/request"] parameters:dict withBlock:block];
}

//获取签到信息
- (void)getCheckInfo:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Sign/index"] parameters:dict withBlock:block];
}

//活动已读接口
- (void)setActivityInfo:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Notice/Setnewsremind"] parameters:dict withBlock:block];
}

//签到
- (void)requestCheck:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Sign/todosign"] parameters:dict withBlock:block];
}

//请求活动列表
- (void)requestActivitList:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Activity/activity_list"] parameters:dict withBlock:block];
}

//请求推送消息
- (void)requestPushMessages:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Notice/noticelist"] parameters:dict withBlock:block];
}

//获取最新消息
- (void)requestNotice:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Notice/checkstatus"] parameters:dict withBlock:block];
}

//已读信息
- (void)readPushMessages:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"Notice/setread"] parameters:dict withBlock:block];
}

//意见反馈图片上传
- (void)feedbackPicture:(UIImage *)image withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];//初始化请求对象
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];//设置服务器允许的请求格式内容
    manager.requestSerializer.timeoutInterval = 30.0;
    [manager POST:[BASEURL stringByAppendingString:@"Personinfo/uploadimage"] parameters:nil constructingBodyWithBlock:^(id  _Nonnull formData) {
        NSData *data = UIImagePNGRepresentation(image);
        [formData appendPartWithFileData:data name:@"file" fileName:@"file.png" mimeType:@"image/png"];
    } progress:^(NSProgress * _Nonnull uploadProgress) {
        NSLog(@"uploadProgress = %@",uploadProgress);
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        NSLog(@"responseObject = %@, task = %@",responseObject,task);
        NSDictionary* dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
        NSInteger status = [[dic objectForKey:@"status"] integerValue];
        if (status == 0) {
            if (block) {
                block(dic,@"0",nil);
            }
        }else{
            if (block) {
                block(dic,@"1",nil);
            }
        }
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"error = %@",error);
        if (block) {
            block(nil,@"1",error);
        }
    }];
}

//图片上传
- (void)uploadPicture:(UIImage *)image withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];//初始化请求对象
    //manager.requestSerializer = [AFJSONRequestSerializer serializer];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];//设置服务器允许的请求格式内容
    //上传图片/文字，只能同POST
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:[[NSUserDefaults standardUserDefaults] objectForKey:UserDataID] forKey:@"user_id"];
    [manager POST:[BASEURL stringByAppendingString:@"Personinfo/uploadheaderimage"] parameters:dict constructingBodyWithBlock:^(id  _Nonnull formData) {
        //对于图片进行压缩
        NSData *data = UIImageJPEGRepresentation(image, 0.5);
        //NSData *data = UIImagePNGRepresentation(image);
        //第一个代表文件转换后data数据，第二个代表图片的名字，第三个代表图片放入文件夹的名字，第四个代表文件的类型
        [formData appendPartWithFileData:data name:@"file" fileName:@"file.png" mimeType:@"image/png"];
    } progress:^(NSProgress * _Nonnull uploadProgress) {
        NSLog(@"uploadProgress = %@",uploadProgress);
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        NSLog(@"responseObject = %@, task = %@",responseObject,task);
        //NSData 转NSString
        //NSString *result  =[[ NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
        NSDictionary* dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
        NSInteger status = [[dic objectForKey:@"status"] integerValue];
        if (status == 0) {
            if (block) {
                block(dic,@"0",nil);
            }
        }else{
            if (block) {
                block(dic,@"1",nil);
            }
        }
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"error = %@",error);
        if (block) {
            block(nil,@"1",error);
        }
    }];

}

//post请求
- (void)basePostRequset:(NSString *)baseURL parameters:(NSMutableDictionary *)dict withBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    // 1.创建请求管理对象
    AFHTTPSessionManager *mgr = [AFHTTPSessionManager manager];
    mgr.requestSerializer = [AFJSONRequestSerializer serializer];
    mgr.responseSerializer = [AFJSONResponseSerializer serializer];
    mgr.requestSerializer.timeoutInterval = 15.0;
    mgr.responseSerializer.acceptableContentTypes = [NSSet setWithArray:@[@"application/json",@"text/html",@"text/plain"]];
    //2.发送请求
    [mgr POST:baseURL parameters:dict progress:^(NSProgress * _Nonnull uploadProgress) {
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        id dic =   [self changeType:responseObject];
        NSInteger status = [[dic objectForKey:@"status"] integerValue];
        if (status == 0 || status == 200) {
            if (block) {
                block(dic,@"0",nil);
            }
        }else{
            if (block) {
                block(dic,@"1",nil);
            }
        }
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        if (block) {
            block(nil,@"1",error);
        }
    }];
}


- (NSDictionary *)nullDic:(NSDictionary *)myDic{
    NSArray *keyArr = [myDic allKeys];
    NSMutableDictionary *resDic = [[NSMutableDictionary alloc]init];
    for (int i = 0; i < keyArr.count; i ++){
        id obj = [myDic objectForKey:keyArr[i]];
        obj = [self changeType:obj];
        [resDic setObject:obj forKey:keyArr[i]];
    }
    return resDic;
}

//将NSDictionary中的Null类型的项目转化成@""
-(NSArray *)nullArr:(NSArray *)myArr{
    NSMutableArray *resArr = [[NSMutableArray alloc] init];
    for (int i = 0; i < myArr.count; i ++){
        id obj = myArr[i];
        obj = [self changeType:obj];
        [resArr addObject:obj];
    }
    return resArr;
}

//将NSString类型的判空后返回
- (NSString *)stringToString:(NSString *)string{
    if([string isEqualToString:@"(null)"] || [string isEqualToString:@"<nil>"] || string == nil || string == NULL){
        return @"";
    }
    return string;
}

//将Null类型的项目转化成@""
-(NSString *)nullToString{
    return @"";
}

#pragma mark - 公有方法
//类型识别:将所有的NSNull类型转化成@""
-(id)changeType:(id)myObj{
    if ([myObj isKindOfClass:[NSDictionary class]]){
        return [self nullDic:myObj];
    }else if([myObj isKindOfClass:[NSArray class]]){
        return [self nullArr:myObj];
    }else if([myObj isKindOfClass:[NSString class]]){
        return [self stringToString:myObj];
    }else if([myObj isKindOfClass:[NSNull class]]){
        return [self nullToString];
    }else{
        return myObj;
    }
}
//查询用户最新的健康数据
- (void)getNewestDetailedHealthData:(NSMutableDictionary *)dict WithBlock:(void (^)(id responseObject, NSString *status, NSError *error))block{
    [self basePostRequset:[BASEURL stringByAppendingString:@"health/queryhealthreport"] parameters:dict withBlock:block];
}
@end
